<template>
  <div class="">
    <el-dialog title="下发详情" :visible.sync="dialogVisible" width="60%">
      <el-row :gutter="20" style="margin-bottom: 10px">
        <el-col :span="6">
          <el-select v-model="formData.is_sync" placeholder="请选择" @change="selcetdata">
            <el-option
              v-for="item in options1"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-col>
        <el-col :span="6"></el-col>
      </el-row>
      <QueryTable
        :tableConfiguration="tableConfiguration"
        :displayContent="displayContent"
        :formData="formData"
        :isPop="true"
        ref="queryTable"
        :api="getTableServe"
      ></QueryTable>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="danger" @click="dialogVisible = false">重新下发</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import QueryTable from '@/components/queryTable/index.vue';

import { groupsyncinfo } from '@/api/comment/permission.js';

export default {
  components: {
    QueryTable
  },
  data() {
    return {
      dialogVisible: false,
      getTableServe: groupsyncinfo,

      //配置文件
      displayContent: {
        height: '50vh',
        indexFixed: true,
        selectionFixed: true,
        selection: false,
        index: true,
        paginationShow: true
      },
      formData: {}, //传给后端的参数
      tableConfiguration: [
        {
          prop: 'name',
          label: '姓名',
          width: '260',
          align: 'center'
        },
        {
          prop: 'no',
          label: '学工号',
          width: '260',
          align: 'center'
        },
        {
          prop: 'merge_name',
          label: '设备',
          width: '260',
          align: 'center'
        },
        {
          prop: 'a4',
          label: '权限类型',
          width: '260',
          align: 'center'
        },
        // {
        //   prop: 'devices',
        //   label: '权限下发时间',
        //   width: '260',
        //   align: 'center'
        // },
        {
          prop: 'status',
          label: '权限下发结果',
          width: '260',
          align: 'center'
        }
      ],
      options1: [
        {
          value: true,
          label: '下发人员'
        },
        {
          value: false,
          label: '未下发人员'
        }
      ]
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    //打开弹窗
    open(data) {
      this.dialogVisible = true;
      this.formData.groupId = data.groupId; //权限组groupId

      this.$set(this.formData, 'is_sync', true);
      this.$nextTick(() => {
        this.$refs.queryTable.handleCurrentChange(1);
      });
    },

    //查询
    selcetdata(e) {
      // this.formData.is_sync = e;

      console.log(this.formData);

      this.$nextTick(() => {
        this.$refs.queryTable.handleCurrentChange(1);
      });
    }
  }
};
</script>

<style lang="scss" scoped></style>
